//
//  AccountDescListViewCell.m
//  quickBatchManager
//
//  Created by 王定波 on 15/10/13.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "AccountDescListViewCell.h"

@implementation AccountDescListViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setAccountData:(id)data
{
    if([data isKindOfClass:[BatchProductModel class]])
    {
        BatchProductModel *batchproduct=(BatchProductModel*)data;
        _label1.text=[batchproduct.createDate substringToIndex:10];
        _label2.text=[ToolUtils numberToStr:batchproduct.totalNumber];
        _label3.text=[ToolUtils priceToStr:batchproduct.totalPrice];
        _label4.text=[ToolUtils priceToStr:batchproduct.isPay==1?batchproduct.totalPrice:batchproduct.paidPrice];
        _label5.text=[ToolUtils priceToStr:[AppService getAmountByUserIdAndDateAndType:batchproduct.supplierId andDate:batchproduct.createDate andType:AccountTypeSupplier]];
        
        _label6.text=(batchproduct.deptPrice==0?@"":[NSString stringWithFormat:@"余额抵扣：%0.2f",batchproduct.deptPrice]);
    }
    else if([data isKindOfClass:[PayOutModel class]])
    {
        PayOutModel *payout=(PayOutModel*)data;
        _label1.text=[payout.payDate substringToIndex:10];
        _label4.text=[ToolUtils priceToStr:payout.amount];
        _label5.text=[ToolUtils priceToStr:[AppService getAmountByUserIdAndDateAndType:payout.supplierId andDate:payout.payDate andType:AccountTypeSupplier]];
    }
    
    else if([data isKindOfClass:[PayInModel class]])
    {
        PayInModel *payout=(PayInModel*)data;
        _label1.text=[payout.payDate substringToIndex:10];
        _label4.text=[ToolUtils priceToStr:payout.amount];
        _label5.text=[ToolUtils priceToStr:[AppService getAmountByUserIdAndDateAndType:payout.clientId andDate:payout.payDate andType:AccountTypeClient]];
    }
    else  if([data isKindOfClass:[SaleOrderModel class]])
    {
        SaleOrderModel *orderproduct=(SaleOrderModel*)data;
        _label1.text=[orderproduct.date substringToIndex:10];
        _label2.text=[ToolUtils numberToStr:orderproduct.totalNumber];
        _label3.text=[ToolUtils priceToStr:orderproduct.totalPrice];
        _label4.text=[ToolUtils priceToStr:orderproduct.isPay==1?orderproduct.totalPrice:orderproduct.paidPrice];
        _label5.text=[ToolUtils priceToStr:[AppService getAmountByUserIdAndDateAndType:orderproduct.clientId andDate:orderproduct.date andType:AccountTypeClient]];
        
        _label6.text=(orderproduct.deptPrice==0?@"":[NSString stringWithFormat:@"余额抵扣：%0.2f",orderproduct.deptPrice]);
    }
    
}

@end
